// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: '2024-07-10',
  devtools: { enabled: true },
  app: {
    // head配置
    head: {
      title: 'Nuxt 3',
      charset: 'utf-8',
      viewport: 'width=device-width, initial-scale=1',
      meta: [
        { name: 'viewport', content: 'width=device-width, initial-scale=1, user-scalable=no' },
        { name: 'screen-orientation', content: 'portrait' },
        { name: 'keywords', content: '' },
        { name: 'description', content: '' }
      ],
      script: [
      ],
    }
  },
  css: [
    // 全局样式
    '@/assets/style/app.css'
  ],
  vite: {
    css: {
      // 修复启动时出现The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
      preprocessorOptions: {
        scss: {
          api: 'modern-compiler'
        }
      }
    },
    // 接口代理配置
    server: {
      proxy: {
        [import.meta.env.VITE_API_PREFIX]: {
          target: import.meta.env.VITE_API_URL,
          changeOrigin: true,
          rewrite: (path:any) => path.replace(new RegExp(`^${import.meta.env.VITE_API_PREFIX}`), '')
        }
      },
    }
  },
  // 扩展内容
  modules: [
  ],
  plugins: [
  ]
})
